package com.senlingspace.web.controller.headquarters;

import java.util.List;

import com.senlingspace.system.domain.dto.FzShopInvestorDto;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.senlingspace.common.annotation.Log;
import com.senlingspace.common.core.controller.BaseController;
import com.senlingspace.common.core.domain.AjaxResult;
import com.senlingspace.common.enums.BusinessType;
import com.senlingspace.system.domain.SlkjShopInvestor;
import com.senlingspace.system.service.ISlkjShopInvestorService;

/**
 * 分账比例-门店投资方关系Controller
 * 
 * @author SenlingSpace
 * @date 2024-07-15
 */
@RestController
@RequestMapping("/system/investorShop")
public class SlkjShopInvestorController extends BaseController
{
    @Autowired
    private ISlkjShopInvestorService slkjShopInvestorService;


    /**
     * 新增分账比例-门店投资方关系
     */
    @PreAuthorize("@ss.hasPermi('system:investorShop:add')")
    @Log(title = "分账比例-门店投资方关系", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody List<SlkjShopInvestor> investorList){
        return toAjax(slkjShopInvestorService.insertSlkjShopInvestor(investorList));
    }

    /**
     * 修改分账比例-门店投资方关系
     */
    @PreAuthorize("@ss.hasPermi('system:investorShop:edit')")
    @Log(title = "分账比例-门店投资方关系", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FzShopInvestorDto shopInvestorDto)
    {
        return toAjax(slkjShopInvestorService.updateSlkjShopInvestor(shopInvestorDto));
    }




    /**
     * 删除分账比例-门店投资方关系
     */
    @PreAuthorize("@ss.hasPermi('system:investorShop:remove')")
    @Log(title = "删除分账比例-门店投资方关系", businessType = BusinessType.UPDATE)
    @DeleteMapping
    public AjaxResult remove(@RequestBody FzShopInvestorDto shopInvestorDto)
    {
        return toAjax(slkjShopInvestorService.deleteSlkjShopInvestorById(shopInvestorDto));
    }
}
